//
//  LabelTableViewCell.m
//  UI13_UITableViewCellHomework
//
//  Created by dllo on 16/6/22.
//  Copyright © 2016年 司昌宝. All rights reserved.
//

#import "LabelTableViewCell.h"
#import "Duanzi.h"
#import "GetHeightTools.h"
@interface LabelTableViewCell ()

@property (nonatomic,retain)UILabel *digestLabel;

@end


@implementation LabelTableViewCell

-(void)dealloc{
    [_digestLabel release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self){
        self.digestLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.digestLabel];
        [_digestLabel release];
    }
    
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    
    
    self.digestLabel.numberOfLines = 0;
    self.digestLabel.frame = CGRectMake(0, 5, self.frame.size.width, [GetHeightTools heightWith:self.duanzi.digest]);
    self.digestLabel.backgroundColor = [UIColor grayColor];
}

-(void)setDuanzi:(Duanzi *)duanzi{
    if (_duanzi != duanzi) {
        [_duanzi release];
        _duanzi = [duanzi retain];
    }
    
    /** !!!!!!!!!!!!!!!!!!!!!数据赋值 */
    self.digestLabel.text = duanzi.digest;
    
    
}

@end
